package com.arcadia.d2.hero_attributes;


public class MagicRes {
	
	private double base;
	private double[] iMagicResistance;
	
	public MagicRes(double base){
		this.base = base;
		iMagicResistance = new double[6];
	}
	
	public double getBase() {
		return base;
	}

	public double[] getIMagicResistance() {
		return iMagicResistance;
	}

	public void setIMagicResistance(double iMagicResistance){
		for (int i = 0; i < 6; i++){
			this.iMagicResistance[i] = iMagicResistance;
		}
	}
	/*
	 * public double calculateIMR(Hero hero){
		
		return 0;
	}

	public void setBaseBySpecial(int id, Ability ability){
		
	}


	*/
	
	public double getMagicResistance(double base, double[] iMagicResistance){
		double totalMagicResistance = 1 - base;
		for (int i = 0; i < iMagicResistance.length; i++){
			totalMagicResistance *= (1 - iMagicResistance[i]);
		}
		return 1 - totalMagicResistance;
	}

	public void setBase(double base) {
		this.base = base;
	}
}
